home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.02 Feb 95 / Yenta / C Libraries / ToolBoxTools.h < prev   
Encoding:
C/C++ Source or Header  |  1996-04-04  |  2.7 KB  |  84 lines  |  [TEXT/KAHL]

  1.  
  2. #pragma once
  3.  
  4. #include <StringTools.h>
  5.  
  6. /*=======================================================================*/
  7. /*= This file contains a set of utilities for doing nifty toolbox stuff =*/
  8. /*=======================================================================*/
  9.  
  10. #define        kEnter        3
  11. #define        kDelete        8
  12. #define        kTab        9
  13. #define        kReturn        13
  14. #define        kEscape        27
  15. #define        kLeftArrow    0x1C
  16. #define        kRightArrow    0x1D
  17. #define        kUpArrow    0x1E
  18. #define        kDownArrow    0x1F
  19.  
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25.     pascal void saveThatA5()
  26.         = {0x2f0d, 0x2a68, 0xFFFC};
  27.         
  28.     pascal void restoreThatA5()
  29.         = {0x2a5f};
  30.  
  31.     Boolean  ButtonStillDownAfterN (long NumTicks);
  32.     /* return true if the button is still down after the specified # of ticks */
  33.  
  34.     StringPtr GetChooserName (StringPtr Default);
  35.     /* return the name which the chooser contains as the user name */
  36.     
  37.     Boolean CommandKeyDown (short modifierKeys);
  38.     /* return true if the command key is held down */
  39.  
  40.     Boolean    ShiftKeyDown (short modifierKeys);
  41.     /* return true if the shift key is held down */
  42.  
  43.     Boolean    OptionKeyDown (short modifierKeys);
  44.     /* return true if the option key is held down */
  45.  
  46.     Boolean    ControlKeyDown (short modifierKeys);
  47.     /* return true if the control key is held down */
  48.  
  49.     short isPressed(unsigned short k );
  50.     /* return ¬0 if the key whose code is k is pressed, 0 otherwise */ 
  51.  
  52.     short getModifiers (void);
  53.     /* get the states of all the modifier keys on the keyboard and return them */
  54.     /* in the format used in the 'modifier' field of an event record */
  55.  
  56.     void TimeString (long inDateTime, Boolean showAMPM, StringPtr DestString, short maxLen);
  57.     /* Given a Macintosh DateTime quantity, return a string of the format */
  58.     /* hr:mn:sec [A|P]M */
  59.     
  60.     void CurrentTimeString (Boolean showAMPM, StringPtr DestString, short maxLen);
  61.     /* Return a string of the format hr:mn:sec [A|P]M which represents the current time */    
  62.  
  63.     void ErrorAlert (short ErrorID, StringPtr Message);
  64.     /* Puts up a dialog which displays an error in one of the
  65.        following ways:
  66.        1) if there is an STR resource with the same ID as ErrorID, that
  67.              message is displayed along with the passed-in message
  68.        2) if there is no STR resource, the ErrorID and the passed-in
  69.           message are displayed.
  70.     */
  71.  
  72.     void CenterRect (Rect *Source, Rect *Target, Boolean CenterH, Boolean CenterV);
  73.     /* center the source inside the target according to CenterH and centerV */
  74.     /* Source rectangle is modified, Target rectangle is not changed */
  75.  
  76.     pascal void SetMenuItemText(MenuHandle theMenu,short item,StringPtr itemString);
  77.  
  78.     void CopyResource (short RFrom, short RTo, ResType itsType, short itsID);
  79.     /* copy the specified resource from the resource file specified by */
  80.     /* RFrom into the resource file specified by RTo */
  81.  
  82. #ifdef __cplusplus
  83. }
  84. #endif